<script language="javascript">
// add multiple select / deselect functionality : Starts
$(function(){
  
  $(".selectall").click(function () {
    $('.case'+$(this).val()).attr('checked', this.checked);
  });
});
// add multiple select / deselect functionality : Ends
</script>
<br />
<div style="border:0px solid black;display:block;width:250px; ">
	<h3>
		<u>Final Master Sr. No.</u> : 
    <b>{$fmSrNo}<input type="hidden" name="fmSrNo" value="{$srNo}"</b>
  </h3>
</div>
{section name="sec" loop=$deliveryChallanArray}
  {if $deliveryChallanArray[sec].display == 1}
		<table align="center" border="1">
		<tr>
		  <td class="table5" align="center">&nbsp;</td>
		  <td class="table5" align='center'><B>Sr.Record No.</td>
		  <td class="table5" align='center'><B>Customer</td>
			<td class="table5" align='center'><B>Challan No.</td>
			<td class="table5" align='center'><B>Date</td>
			<td class="table5" align='center'><B>Challan Type</td>
		</tr>
		<tr>
		  <td class="table3">
		    <input type="checkbox" class="selectall" name="deliveryChallanMasterId[]" value="{$deliveryChallanArray[sec].deliveryChallanMasterId}" />
		  </td>  
		  <td class="table3" align="center">{$smarty.section.sec.rownum}</td>
		  <td class="table3" align="left">{$deliveryChallanArray[sec].companyName}</td>
		  <td class="table3" align="right">{$deliveryChallanArray[sec].srNo}</td>
		  <td class="table3" align="right">{$deliveryChallanArray[sec].delivaryDate}</td>
		  <td class="table3" align="right">{$deliveryChallanArray[sec].challanType}</td>
		</tr>

		<tr>
		  <table align="center" border="1">
		  <tr>
		    <th class="table1">&nbsp;</th>
		    <th align="left"  class="table1">SubCategory</th>
		    <th align="center" class="table1">Item</th>
		    <th align="center" class="table1">Quantity Supplied</th>
		    <th class="table1">Quantity Used</th>
		  </tr>
		  {assign var="countRow" value="0"}
		  {section name="sec1" loop=$deliveryDetailArray[sec]}
		  <input type="hidden" name="countRow" value="{$countRow++}">
		  <tr>
		    <td class="table3">
		      <input type="checkbox" class="case{$deliveryChallanArray[sec].deliveryChallanMasterId}" id="deliveryChallanDetailId[]" name="deliveryChallanDetailId[{$deliveryDetailArray[sec][sec1].deliveryChallanDetailId}]" value="{$deliveryDetailArray[sec][sec1].deliveryChallanDetailId}" />
		    </td> 
		    <td class="table3">{$deliveryDetailArray[sec][sec1].subCategoryName}</td>
		    <td class="table3" NOWRAP>{$deliveryDetailArray[sec][sec1].itemName}</td>
		    <td class="table3" align="right">{$deliveryDetailArray[sec][sec1].quantity}</td>
		    <td class="table3" align="center">
		      <input type="text" name="qtyTaken[{$deliveryDetailArray[sec][sec1].deliveryChallanDetailId}]" id="qtyTaken[]" size="2" value="{$deliveryDetailArray[sec][sec1].quantity}" />
		    </td>
		    {/section}
		  </tr>
		  </table>
		</tr>
		</table>
	{/if}
{/section}
{if $countRow == 0}
   <tr class="table2">
	 <td align="center" colspan="10"><h2><center><font color="red"><b>{$msg}</b></font></center></h2></td>
   </tr>
{/if}
{if $countRow != 0}
<br />
<center><input type="submit" name="submitDateBtn" value="Submit" class="button"/>
        <input type="Submit" name="Cancel" value="Cancel" class="button"/></center>
{/if}
<br />
